package com.hospital.schedule.module.controller;


import com.hospital.common.base.Result;
import com.hospital.schedule.module.service.ITDoctorAttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 医⽣考勤记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-15
 */
@RestController
public class TDoctorAttendanceController {
    @Autowired
    private ITDoctorAttendanceService tDoctorAttendanceService;
    /**
     * 添加医⽣考勤记录
     * @return doctorId 医生 ID
     * @return 添加结果
     */
    @GetMapping("/addDoctorAttendance")
    public Result addDoctorAttendance(@RequestParam("doctorId") Long doctorId){
//        ThreadAttributes threadAttributes = ThreadLocalUtils.get();
//        return Result.success(tDoctorAttendanceService.addDoctorAttendance
//                (threadAttributes.getUserId()));
        return Result.success(tDoctorAttendanceService.addDoctorAttendance
                (doctorId));
    }
    /**
     * 查询是否有签到记录
     * @return 0 无签到记录 1 有签到记录
     */
    @GetMapping("/findIfDoctorAttendanceByNow")
    public Result findIfDoctorAttendanceByNow(@RequestParam("doctorId") Long doctorId){
//        ThreadAttributes threadAttributes = ThreadLocalUtils.get();
//        return Result.success(tDoctorAttendanceService.findIfDoctorAttendanceByNow
//                (doctorId));
        return Result.success(tDoctorAttendanceService.findIfDoctorAttendanceByNow
                (doctorId));
    }
    /**
     * 是否早退
     * @return 0 未早退 1 早退
     */
    @GetMapping("/isEarlyLeave")
    public Result isEarlyLeave(@RequestParam("doctorId") Long doctorId){
//        ThreadAttributes threadAttributes = ThreadLocalUtils.get();
        return Result.success(tDoctorAttendanceService.isEarlyLeave(doctorId));
    }
}
